Skip to content

Refresh file listings on breadcrumb navigation after bitstream upload#112

Merged
kosarko merged 8 commits intoclarin-v7from
70-item-requires-page-refresh-when-new-bitstream-is-added
Apr 28, 2026
Merged

Refresh file listings on breadcrumb navigation after bitstream upload#112
kosarko merged 8 commits intoclarin-v7from
70-item-requires-page-refresh-when-new-bitstream-is-added

Conversation

@amadulhaxxani
Copy link
Copy Markdown

Refresh file listings on breadcrumb navigation after bitstream upload

Problem description

After uploading a bitstream to an item, the file list component would not refresh when navigating back to the item page via breadcrumb. The uploaded file would not appear in the item view without a manual page refresh, because stale cached bitstream data was being returned from the metadatabitstreams byHandle endpoint.

Copilot review

  • Requested review from Copilot

Refresh file listings on breadcrumb navigation after bitstream upload
Copilot AI review requested due to automatic review settings March 12, 2026 14:50
@amadulhaxxani amadulhaxxani linked an issue Mar 12, 2026 that may be closed by this pull request
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes stale file listings after a bitstream upload when returning to the item page via breadcrumbs by forcing fresh item/bitstream-related data resolution instead of reusing cached metadatabitstreams results.

Changes:

  • Refresh preview/CLARIN file list components when their item/itemHandle inputs change (and manage subscriptions).
  • Adjust item resolution to allow re-requesting when cached responses become stale.
  • Mark relevant cached requests as stale after a successful bitstream upload, and extend unit tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/app/item-page/simple/field-components/preview-section/preview-section.component.ts Refresh bitstream listing when item input changes; adds subscription cleanup.
src/app/item-page/item.resolver.ts Enables reRequestOnStale when resolving items by ID.
src/app/item-page/clarin-files-section/clarin-files-section.component.ts Refresh CLARIN file list when item/itemHandle inputs change; adds subscription cleanup.
src/app/item-page/bitstreams/upload/upload-bitstream.component.ts Marks multiple cached requests stale after upload to force fresh data on navigation back.
src/app/item-page/bitstreams/upload/upload-bitstream.component.spec.ts Extends tests to account for additional cache-staling behavior.

Comment thread src/app/item-page/bitstreams/upload/upload-bitstream.component.ts Outdated
Comment thread src/app/item-page/bitstreams/upload/upload-bitstream.component.ts Outdated
Move refresh logic to ngOnChanges
Set related requests stale instead of removing cache
Use setStaleByHrefSubstring for metadatabitstreams cache
Add null checks for nested RemoteData access
Copy link
Copy Markdown
Member

@kosarko kosarko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amadulhaxxani While this seems to refresh correctly after adding a bitstream, a similar issues is there when I remove the bitstream (shouldn't be much of an issue in production, but if it is a quick fix...).
Also see the two comments

Comment thread src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts Outdated
amadulhaxxani and others added 2 commits April 27, 2026 16:46
Replace uses of this.bitstream with the local bitstream observable in edit-bitstream-page to reference the correct stream when computing image/IIIF/enabled flags.

After removing bitstreams, clear relevant caches in item-bitstreams: mark bundle bitstreams hrefs stale and invalidate metadatabitstreams search-by-handle (both encoded and raw variants) so file lists, previews and CLARIN file sections refresh correctly.
- PreviewSectionComponent: store and unsubscribe configService subscription
  in ngOnDestroy to prevent memory leak
- ItemBitstreamsComponent: add hasValue() null guard before bundles.forEach()
  for idiomatic style

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kosarko
Copy link
Copy Markdown
Member

kosarko commented Apr 28, 2026

@amadulhaxxani can you check 36b3fc6

@amadulhaxxani
Copy link
Copy Markdown
Author

@kosarko its fine but the pipeline failed, I will fix the issue and will push again

@kosarko kosarko merged commit 45bacd6 into clarin-v7 Apr 28, 2026
14 of 16 checks passed
@port-pr
Copy link
Copy Markdown

port-pr Bot commented Apr 28, 2026

Backport branch created but failed to create PR.
Request to create PR rejected with status 403.

Please create the PR manually:

Or via GitHub CLI:

gh pr create --repo dataquest-dev/dspace-angular --base dtq-dev --head ufal:backport-112-to-dtq-dev --title "[Port dtq-dev] Refresh file listings on breadcrumb navigation after bitstream upload" --body "Port of #112 by @amadulhaxxani to `dtq-dev`."

(see action log for full error response)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Item requires Page Refresh when new Bitstream is added

3 participants